package com.feituan.wx.controller;

import com.feituan.core.pojo.entity.EquipmentShop;
import com.feituan.core.pojo.request.EquipmentShopPageReq;
import com.feituan.core.pojo.response.Response;
import com.feituan.core.pojo.response.page.PageData;
import com.feituan.core.service.IEquipmentShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/equipmentShop")
public class EquipmentShopController extends BaseController{
    @Autowired
    private IEquipmentShopService equipmentShopService;

    /**
     * 保存修改
     * @param equipmentShop equipmentShop
     */
    @PostMapping("/save")
    public Response<Boolean> save(EquipmentShop equipmentShop) {
        return Response.success(equipmentShopService.save(equipmentShop));
    }

    /**
     * 删除
     * @param id id
     */
    @PostMapping("/delete")
    public Response<Boolean> delete(Long id) {
        return Response.success(equipmentShopService.delete(id));
    }

    /**
     * 更新
     * @param equipmentShop equipmentShop
     */
    @PostMapping("/update")
    public Response<Boolean> update(EquipmentShop equipmentShop) {
        return Response.success(equipmentShopService.update(equipmentShop));
    }


    /**
     * 分页查询
     * @param equipmentShopPageReq equipmentShopPageReq
     */
    @PostMapping("/list_page")
    public Response<PageData<EquipmentShop>> queryPage(EquipmentShopPageReq equipmentShopPageReq) {
        return Response.success(equipmentShopService.queryPage(equipmentShopPageReq));
    }

    /**
     * 根据店铺id查询
     * @param shopId shopId
     */
    @PostMapping("/selectByShopId")
    public List<EquipmentShop> selectByShopId(Long shopId) {
        return equipmentShopService.selectByShopId(shopId);
    }

}
